<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class LoginRequest extends FormRequest
{
    /**
     * 验证
     */
    public function authorize() {
        return true;
    }
    /**
     * 表单验证
     */
    public function rules() {
        return [
            'username' => 'required',
            'password' => 'required',
            'captcha'  => 'required|captcha'
        ];
    }
    /**
     * 自定义验证错误信息
     */
    public function messages() {
        return [
            'captcha.required' => '验证码不能为空',
            'captcha.captcha'  => '验证码错误',
        ];
    }
}
